// components/good-item-image/good-item-image.js
let WxParse = require('../../utils/wxParse/wxParse.js');
Component({

  options: {
    addGlobalClass: true,//使用app.wxss样式
  },

  /**
   * 组件的属性列表
   */
  properties: {
    goods: {
      type: Object,
      //监听数据变化
      observer(newVal,oldVal,changedPath){
        if(Object.keys(newVal).length != 0) {//数据不为空
          WxParse.wxParse('description', 'html', newVal.description, this, 5);
          this.setData({goods:newVal});
        }
      }
    },
    commentInfo: {
      type: Object,
      //监听数据变化
      observer(newVal,oldVal,changedPath){
        if(Object.keys(newVal).length != 0) {//数据不为空
          this.setData({commentInfo:newVal,commentList:newVal.pageUtils.rows});
          console.log(this.data.commentList);
        }
      }
    },
  },

  /**
   * 组件的初始数据
   */
  data: {
    commentInfo:{},
    commentList:[],
    goods:{},
  },

  lifetimes: {
    attached(){

    },
  },

  /**
   * 组件的方法列表
   */
  methods: {
    jumpCommentList:function(){
      wx.navigateTo({
        url: '/subIndex/index/commentList/commentList?productId='+this.data.goods.id,
      })
    },
  }
})
